<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Editing/Creating Users</title>
</head>
<body>
<%
String editing = "false";
String username = "";
String password = "";

if(request.getAttribute("username") != null) {
	username = request.getAttribute("username").toString();
}

if(request.getAttribute("password") != null) {
	password = request.getAttribute("password").toString();
}

if(request.getAttribute("editing") != null) {
	editing = request.getAttribute("editing").toString();
	
	if(editing.equals("true")) {
		String div = "<div id=" + "error" +">";
		out.println(div);
		out.println("Wachtwoord wijzigen");
		out.println("</div>");
	}
}
//Login failed
if(request.getAttribute("fail") != null) {
	String div = "<div id=" + "error" +">";
	out.println(div);
	out.println("Geen lege tekst invullen, supertramp!");
	out.println("</div>");
}
%>
		<form name="myForm">
    					<input id="editing" type="hidden" name="editing" value="<%=editing %>"></input>
    					<input id="session" type="hidden" name="session" value="<%=request.getSession().getId() %>"></input>
    					<table>
    						<tr>
       						 	<td>
       						 		<label id="usernamelabel">Gebruikersnaam:</label></td>
						        <td>
						        	<input id="usernameform" type="text" name="usernameform" <% if(!username.equals("")){out.println("value=\"" + username + "\"");} %>>
						        </td>
						       </tr>
					      	<tr>
						        <td>
						        	<label  id="passwordlabel">Wachtwoord:</label>
						        </td>
						        <td>
						        	<input id="passwordform" type="password" name="passwordform">
						        </td>
							</tr>
						    <tr>
						        <td colspan="2">
						        	<input type="button" value="Submit" onClick="javascript:addingUser();" >
						        </td>
						 	</tr>
    					</table>
		</form> 

</body>
</html>